package com.iexbuy.ihg.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.iexbuy.ihg.R;
import com.iexbuy.ihg.entity.CashHistoryListObject;
import com.iexbuy.ihg.entity.ReComment;

import java.util.ArrayList;
import java.util.List;

;

public class RecommentListAdapter extends BaseAdapter {

	private List<ReComment> datas = new ArrayList<ReComment>();
	private Context context;

	public RecommentListAdapter(Context context, List<ReComment> datas) {
		super();
		this.context = context;
		if (datas != null) this.datas = datas;
	}

	@Override
	public int getCount() {
		return datas.size();
	}

	@Override
	public Object getItem(int location) {
		return datas.get(location);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = LayoutInflater.from(context).inflate(R.layout.fragment_wede_recomment_list_item, null);
		}
		ReComment vo = (ReComment)datas.get(position);

		((TextView) convertView.findViewById(R.id.itemTitle)).setText(vo.getCtime());
		//((TextView) convertView.findViewById(R.id.itemType)).setText(vo.getTypeName());
		((TextView) convertView.findViewById(R.id.itemSubtitle)).setText(vo.getContents());
		((TextView) convertView.findViewById(R.id.itemStatus)).setText(vo.getStatusName());

		return convertView;
	}
	
	private Double getMagnitude(String magnitudeStr) {
		Double magnitude = Double.valueOf("0");
		try {
			magnitude = Double.valueOf(magnitudeStr);
		} catch (Exception e) {
		}
		return magnitude;
	}
	
}
